<include file="Public/head" />

<body>
  <form action="" id="listform">
    <div class="panel admin-panel">
      <div class="panel-head"><strong class="icon-reorder"> {:L("quanxianguanli")}</strong></div>
      <div class="padding border-bottom">
        <ul class="search" style="padding-left:10px;">
          <li><a class="button border-main icon-plus-square-o" href="{:U('Staff/staff_edit')}"> {:L("tianjia")}</a></li>
        </ul>
      </div>
      <table class="table table-hover text-center">
        <tr>
          <th>{:L("user")}</th>
          <th>{:L("quanxian")}</th>
          <th>{:L("tianjiashijian")}</th>
          <th width="310">{:L("caozuo")}</th>
        </tr>
        <foreach name="info" item="v">
          <tr class="tr{$v['com_id']}">
            <td>{$v['user_name']|default="--"}</td>
            <td>{$v['temp']}</td>
            <td>{$v['add_time']|date="Y-m-d H:i:d",###}</td>
            <td>
              <div class="button-group">
                <a class="button border-main" href="{:U('Staff/staff_edit',array('id'=>$v['com_id']))}"><span class="icon-edit"></span> {:L("bianji")}</a>
                <if condition="$v['parent_id'] neq 0">
                <a class="button border-red" href="javascript:void(0)" onclick="return del({$v['com_id']})"><span class="icon-trash-o"></span> {:L("shanchu")}</a>
                </if>
              </div>
            </td>
          </tr>
        </foreach>
      </table>
    </div>
  </form>
  <script type="text/javascript">
    function del(id){
      if(confirm("{:L('shanchuxiaoxi')}")){
        var url = "{:U('Staff/staff_del')}";
        $.getJSON(url,{id:id},function (data){
          if(data.result == 'tp'){$(".tr"+id).remove();}
          else if(data.result == 'break'){alert('ERROR.');}
        })
      }
    }
  </script>
</body>

</html>